package com.itxiuyixiu.homework.entity.dto;

import com.itxiuyixiu.homework.entity.model.Course;
import com.itxiuyixiu.homework.entity.model.Major;
import com.itxiuyixiu.homework.entity.model.Teacher;

import javax.persistence.*;
import java.time.LocalDateTime;

/**
 * @author 黄磊
 * @date 2020/3/5
 */
public class CourseDto implements Cloneable {

    /**
     * id
     */
    private Integer id;

    /**
     * 课程名字
     */
    private String courseName;

    /**
     * 课程介绍
     */
    private String introduction;

    /**
     * 是否开放选课
     */
    private boolean opened;

    private Integer teacherId;

    private Integer majorId;

    public static Course parseCourse(CourseDto dto , Teacher teacher , Major major){
        Course course = new Course();
        course.setCourseName(dto.getCourseName());
        course.setIntroduction(dto.getIntroduction());
        course.setOpened(dto.isOpened());
        course.setTeacher(teacher);
        course.setMajor(major);
        return course;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCourseName() {
        return courseName;
    }

    public void setCourseName(String courseName) {
        this.courseName = courseName;
    }

    public String getIntroduction() {
        return introduction;
    }

    public void setIntroduction(String introduction) {
        this.introduction = introduction;
    }

    public boolean isOpened() {
        return opened;
    }

    public void setOpened(boolean opened) {
        this.opened = opened;
    }

    public Integer getTeacherId() {
        return teacherId;
    }

    public void setTeacherId(Integer teacherId) {
        this.teacherId = teacherId;
    }

    public Integer getMajorId() {
        return majorId;
    }

    public void setMajorId(Integer majorId) {
        this.majorId = majorId;
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}
